<?php
class RM_Drupal_Controller_Router extends RM_Controller_Router_Rewrite {
  public function _($controller = '', $action = '', $options = array()) {
    $userParams = array_merge($options, array('actions' => $controller, 'controllers' => $action));
    return $this->assemble($userParams);
  }
  public function assemble($userParams, $name = null, $reset = false, $encode = true) {
        $url = parent::assemble($userParams, $name, $reset, $encode);
        if ($this->_module == 'admin') {
          // function base_path() return path to install drupal folder
          $drupal_url = url('admin/resmania/view', $options = array('absolute' => TRUE));
          $url = $drupal_url . $url;
            //$url = base_path().'admin/resmania'.$url;
        } else {
            //$url = base_path().'user/resmania'.$url;
          $drupal_url = url('user/resmania/view', $options = array('absolute' => TRUE));
          $url = $drupal_url . $url;
        }
        return $url;
    }
}
